export const getListData = (data,total) => {
  return {
    type   : "GETLIST",
    payload: {
      rows : data,
      total: total
    }
  };
};

export const getList = (page=1,size=10) => {
  var total = 0
  return dispatch => {
    fetch(`http://134.175.39.187:3001/product?_page=${page}&_limit=${size}`)
      .then(function(res) {
      
        total = res.headers.get('X-Total-Count')
        return res.json();
      })
      .then(function(data) {
       
        dispatch(getListData(data,total));
      });
  };
};
